const path = require('path');

module.exports = {
  assetsDir: 'static',
  publicPath: './',
  productionSourceMap: false,
  chainWebpack: config => {
    config.resolve.alias
      .set('@', path.join(__dirname, 'src'));
  },
  configureWebpack: config => {
    if (process.env.NODE_ENV === 'production') {
      config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true;
    }
  },
  css: {
    loaderOptions: {
      postcss: {
        // 这是rem适配的配置  注意： remUnit在这里要根据lib-flexible的规则来配制，如果您的设计稿是750px的，用75就刚刚好。
        plugins: [
          require('postcss-px2rem')({
            remUnit: 75
          })
        ]
      }
    }
  },
  pluginOptions: {
    dll: {
      entry: {
        vue: [
          'vue/dist/vue.esm.js',
          'vuex',
          'vue-router'
        ],
        util: ['xss', 'axios', 'ramda', 'hashids']
      },
      filePath: './dll/'
    }
  }
};
